<ion-view view-title="理财持仓">
    <ion-nav-buttons side="left">
        <back-button></back-button>
    </ion-nav-buttons>
    <ion-content class="fund">

        <ion-refresher pulling-text={{PULLING_TEXT}} pulling-icon="" refreshing-text={{REFRESHING_TEXT}}
                       on-refresh="doRefresh()"></ion-refresher>

        <!--<ion-list>-->
        <div ng-repeat="item in shares">
            <div class="panel_head" ng-if="$first"  style="padding-top: 15px"><i class="icon_cStar"></i>{{item.fund_alias}}</div>
            <div class="panel_head" ng-if="!$first"><i class="icon_cStar"></i>{{item.fund_alias}}</div>
            <div class="panel">
                <div class="item">
                    <h2>{{item.prod_name}}</h2>

                    <p>{{item.prod_code}}</p>
                    <div class="fr" ng-if="'2'!=item.prod_profit_mode">
                         <span ng-if="item.enableSell && (item.prod_status == 0 || item.prod_status == 2)" class="btn sell"
                               sell-button allot_no="{{item.allot_no}}" prod_code="{{item.prod_code}}" prod_source="{{item.prodSource}}">卖出</span>
                        <span ng-if="!item.enableSell && (item.prod_status == 0 || item.prod_status == 2)" class="btn sell disable">卖出</span>
                        <span ng-if="item.prod_status == 3" class="btn sell disable">暂停赎回</span>
                        <span ng-if="item.prod_status == 5" class="btn sell disable">封闭期</span>
                        <span ng-if="item.prod_status== 1" class="btn sell disable">暂停交易</span>
                    </div>
                </div>

                <a ng-if="'0'==item.prod_profit_mode && 'dzxfund'!=item.prod_catalog_mark"
                   ng-href="#/tab/account-shareDetail?allotNo={{item.allot_no}}&prodCode={{item.prod_code}}&prodSource={{item.prodSource}}&enable_amount={{item.enable_amount}}&trans_account={{item.trans_account}}">
                    <ul class="income-items column-3 clearfix">
                        <li>{{param.prevDate}}收益<em class="inc">{{(item.current_amount / 10000) * item.prod_gain | defNumber: 2 }}<sub>元</sub></em></li>
                        <li>累计收益<em class="inc">{{item.total_income | defNumber:2}}<sub>元</sub></em></li>
                        <li>基金金额<em>{{item.total_invest | defNumber:2}}<sub>元</sub></em></li>
                    </ul>
                </a>

                <a ng-if="'0'==item.prod_profit_mode && 'dzxfund'==item.prod_catalog_mark"
                   ng-href="#/tab/account-shareDetailShort?allotNo={{item.allot_no}}&prodCode={{item.prod_code}}&prodSource={{item.prodSource}}&enable_amount={{item.enable_amount}}&payAccount={{item.pay_account}}&transactionaccountid={{item.transactionaccountid}}">
                    <ul class="income-items column-3 clearfix">
                        <li>{{param.prevDate}}收益<em class="inc">{{(item.current_amount / 10000) * item.prod_gain | defNumber: 2 }}<sub>元</sub></em></li>
                        <li>累计收益<em class="inc">{{item.total_income | defNumber:2}}<sub>元</sub></em></li>
                        <li>基金金额<em>{{item.total_invest | defNumber:2}}<sub>元</sub></em></li>
                    </ul>
                </a>
                <time class="item" ng-if="'0'==item.prod_profit_mode && 'dzxfund'==item.prod_catalog_mark && item.short_term_fund.length > 0">
                    <i class="icon_date"></i>
                    <i class="icon_more" ng-click="shortDetail(item.fundcode,item.transactionaccountid,item.prodSource,item.pay_account)"
                       ng-show="item.short_term_fund.length > 1"></i>
                    可卖时间：{{item.short_term_fund[0].redeem_end_date}}
                    {{item.pay_account_empty ? " 9:00-15:00" : " 当日15:00前"}}
                </time>

                <a ng-if="'1'==item.prod_profit_mode"
                   ng-href="#/tab/account-shareDetailQDII?allotNo={{item.allot_no}}&prodCode={{item.fundcode}}&prodSource={{item.prodSource}}&transactionaccountid={{item.transactionaccountid}}">
                    <ul class="income-items column-3 clearfix">
                        <li>总盈亏<em class="{{item.total_income>=0 ? 'inc' : 'inc_'}}">{{item.total_income | defNumber:2}}<sub>元</sub></em></li>
                        <li>参考收益率<em class="{{item.rate>=0 ? 'inc' : 'inc_'}}">{{item.rate | defNumber:2}}<sub>%</sub></em></li>
                        <li>基金金额<em>{{item.total_invest | number:2}}<sub>元</sub></em></li>
                    </ul>
                </a>

                <a ng-if="'2'==item.prod_profit_mode"
                   ng-href="#/tab/account-shareDetailBank?allotNo={{item.allot_no}}&prodCode={{item.fundcode}}&prodSource={{item.prodSource}}&transactionaccountid={{item.transactionaccountid}}">
                    <ul class="income-items clearfix">
                        <li>预期收益<em class="inc">{{item.reIncome | defNumber:2}}<sub>元</sub></em></li>
                        <li>总资产<em>{{item.total_income| defNumber:2}}<sub>元</sub></em></li>
                    </ul>
                </a>
                <time ng-if="'2'==item.prod_profit_mode" class="item">
                    <i class="icon_date"></i><em><i class="icon_more" ng-click="redeemDetail(item.fundcode,item.prod_expire_date,item.bank_name,item.pay_account)"></i></em>到期时间：{{item.prod_expire_date | defDateString : 1}}，到期自动赎回</time>

                <a ng-if="'3'==item.prod_profit_mode"
                   ng-href="#/tab/account-shareDetailGather?allotNo={{item.allot_no}}&prodCode={{item.fundcode}}&prodSource={{item.prodSource}}">
                    <ul class="income-items column-3 clearfix">
                        <li>总盈亏<em class="{{item.total_income>=0 ? 'inc' : 'inc_'}}">{{item.total_income| defNumber:2}}<sub>元</sub></em></li>
                        <li>参考收益率<em class="{{item.rate>=0 ? 'inc' : 'inc_'}}">{{item.rate | defNumber:2}}<sub>%</sub></em></li>
                        <li>基金金额<em>{{item.total_invest | defNumber:2}}<sub>元</sub></em></li>
                    </ul>
                </a>
                <time class="item" ng-if="'3'==item.prod_profit_mode && param.sys_time == item.prod_expire_date">
                    <i class="icon_date"></i>
                    <i class="icon_more" ng-click="gatherDetail(item.shareDesc)" >
                    </i>到期时间{{item.prod_expire_date | defDateString : 1}}到期自动赎回
                </time>
                <time ng-if="'3'==item.prod_profit_mode && param.sys_time != item.prod_expire_date" class="item">
                    <i class="icon_date"></i><em ng-bind-html="item.shareDesc"></em>
                </time>
                <time class="item" ng-if="item.prod_status == 5">
                    <i class="icon_date"></i>目前处于封闭期，封闭期结束后可开放卖出
                </time>
            </div>
        </div>
        <!--</ion-list>-->
        <div class="little-tip ng-hide" ng-show="param.isLoaded" style="margin-top: 10px" ng-if="shares.length == 0">暂无理财持仓！<br>
            购买订单提交后，请在“理财记录”页查询该订单状态，待购买确认后可在“理财持仓”页查询。
        </div>
        <div class="little-tip ng-hide" ng-show="param.isLoaded" ng-if="shares.length != 0">购买订单提交后，请在“理财记录”页查询该订单状态，待购买确认后可在“理财持仓”页查询。</div>
    </ion-content>
</ion-view>